;; EX-32.scm - Reverberated sine percussion (JMcC)

(let ((d 10)				; number of percolators
      (c 7)				; number of comb delays
      (a 4))				; number of allpass delays

  ;; Sine percolation sound
  (let* ((s (Mix (map (lambda (i)
			(Resonz.ar (Dust.ar (/ 2 d) 50) 
				   (+ 200 (random 3000)) 
				   0.003))
		      (iota d))))
	 
	 ;; Reverb predelay time
	 (z (DelayN.ar s 0.048))
	 
	 ;; `c' length modulated comb delays in parallel
	 (y (Mix (CombL.ar z 0.1 (LFNoise1.kr (random-list c 0.1) 0.04 0.05) 15)))
	 
	 ;; Chain of `a' allpass delays on each of two channels
	 (x (let loop ((x y) (i 0))
	      (if (>= i a)
		  x
		  (loop (AllpassN.ar y 0.050 (random-list 2 0.05) 1)
			(+ i 1))))))
	 
    ;; Add original sound to reverb and play it
    (Add s (Mul 0.2 x))))
